<template>
    <div>
        <el-table
            :data="recordlist"
            style="width: 100%">
            <el-table-column
                prop="course.name"
                label="课程名称"
                width="180">
            </el-table-column>
            <el-table-column
                prop="student.name"
                label="学生"
                width="180">
            </el-table-column>
            <el-table-column
                prop="teacher.name"
                label="授课老师">
            </el-table-column>
            <el-table-column
                prop="course.classTime"
                label="上课时间">
            </el-table-column>
            <el-table-column
                prop="course.type"
                label="类型"
                width="100"
                :filters="[{ text: '考试', value: '1' }, { text: '考察', value: '0' }]"
                :filter-method="filterTag"
                filter-placement="bottom-end">
                <template slot-scope="scope">
                <el-tag
                    :type="scope.row.type == '1' ? 'primary' : 'success'"
                    disable-transitions>{{scope.row.course.type == '1' ? '考试' : '考察'}}</el-tag>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<style lang="less">
</style>

<script>
import { getAllRecords } from '@/api/couser'

export default {
  name: 'RecordView',
  data () {
    return {
      recordlist: ''
    }
  },
  methods: {
    filterTag (value, row) {
      return row.type === value
    }
  },
  mounted: async function () {
    this.recordlist = (await getAllRecords()).data
    console.log(this.recordlist)
  }
}
</script>
